﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="hotelList.aspx.vb" Inherits="travel.hotelList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
    <br /><asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            DataSourceID="tagsDataSource">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="Tag" 
                    DataNavigateUrlFormatString="hotelsByTag.aspx?Tag={0}" DataTextField="tag" />
            </Columns>
        </asp:GridView>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="hotelUrl" 
                DataNavigateUrlFormatString="{0}" DataTextField="HotelName" 
                HeaderText="Hotels" />
            <asp:HyperLinkField DataNavigateUrlFields="location" 
                DataNavigateUrlFormatString="http://maps.google.co.uk/maps?q={0}" 
                DataTextField="Location" HeaderText="Location" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:ImageField DataImageUrlField="Picture" HeaderText="Pictures">
                <ControlStyle CssClass="hotelImage" />
            </asp:ImageField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="hotelInformation.aspx?ID={0}" HeaderText="More Details" 
                Text="Details" />
              <%--  Change the stars from a number into a sequence of asterisks using a template field--%>
            <asp:TemplateField HeaderText="Stars">
         <%--Pass the eval stars to a function in the code behind to generate the number of stars using a loop--%>
            <ItemTemplate><%# getStars(Eval("Stars"))%></ItemTemplate></asp:TemplateField>

        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hotelsConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:hotelsConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [hotellist]"></asp:SqlDataSource>
</p>
    <p>
        
        <asp:SqlDataSource ID="tagsDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:hotelsConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:hotelsConnectionString.ProviderName %>" 
            SelectCommand="SELECT DISTINCT [tag] FROM [tags]"></asp:SqlDataSource>
</p>
    <p>
        &nbsp;</p>
<p>
</p>
</asp:Content>
